package com.heima.admin.controller.v1;

import com.heima.admin.service.AdUserService;
import com.heima.model.admin.dtos.AdUserDto;
import com.heima.model.admin.pojos.AdUser;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

/**
 * @author liuyaning
 * @version 1.0
 * @date 2021/7/30 15:31
 */
@Api(value = "用户管理", tags = "user", description = "用户管理API")
@RestControllerAdvice
@RequestMapping("/login")
public class AdUserController {
    @Autowired
    private AdUserService adUserService;

    @ApiOperation("用户登陆")
    @PostMapping("/in")
    public ResponseResult in(@RequestBody AdUserDto adUserDto){
        return adUserService.in(adUserDto);
    }

    @ApiOperation("用户注册")
    @PostMapping("/register")
    public ResponseResult register(@RequestBody AdUser adUser){

        return  adUserService.register(adUser);
    }
}
